﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;

using Kwan.Data;
using BG.Data;

namespace BG.Service
{
	public class CardQuery
	{

		public static Expression MakeSearchWhere(NameValueCollection ps)
		{
			Expression exp = new Expression();

            string propName = "EntityID";
            if (!string.IsNullOrEmpty(ps[propName]))
                exp &= TCard.entityID == int.Parse(ps[propName]);

			propName = "buildNo";
			if (!string.IsNullOrEmpty(ps[propName]))
			{
				exp &= TCard.buildNo == ps[propName];
			}
			propName = "cardNo";
			if (!string.IsNullOrEmpty(ps[propName]))
			{
				exp &= TCard.cardNo == ps[propName];
			}
			propName = "floorNo";
			if (!string.IsNullOrEmpty(ps[propName]))
			{
				exp &= TCard.floorNo == ps[propName];
			}
			propName = "memo";
			if (!string.IsNullOrEmpty(ps[propName]))
			{
				exp &= TCard.memo == ps[propName];
			}
			propName = "roomNo";
			if (!string.IsNullOrEmpty(ps[propName]))
			{
				exp &= TCard.roomNo == ps[propName];
			}

			return exp;
		}
	}
}